const express = require('express');
const router = express.Router();


// 引入各个路由控制器
const login = require('./controllers/login');
const user = require('./controllers/user');
const upload = require('./controllers/upload');
const cosUpload = require('./controllers/cosUpload');
const menu = require('./controllers/menu');
const role = require('./controllers/role');
const post = require('./controllers/post');
const dept = require('./controllers/dept');
const dict  = require('./controllers/dict');


// 定义各个路由
router.post('/api/login', login.login);
router.post('/api/logout', login.logout);
router.post('/api/getInfo', login.getInfo);


router.post('/api/system/getUserList', user.getUserList);
router.post('/api/system/switchUserStatus', user.switchUserStatus)
router.post('/api/system/addUser', user.addUser)
router.post('/api/system/updateUser', user.updateUser)
router.post('/api/system/deleteUser', user.deleteUser)


router.get('/api/getRouters', menu.getRouters);

router.post('/api/system/getMenuList', menu.getMenuList);
router.get('/system/menu/list', menu.getMenuList);
router.post('/api/system/updatedMenu', menu.updatedMenu)
router.post('/api/system/deleteMenu', menu.deleteMenu)



router.post('/api/uploadFile', upload.uploadFile);
router.post('/api/cosUploadFile', cosUpload.cosUploadFile);


// 角色管理
router.post('/api/system/getRoleList', role.getRoleList)
router.post('/api/system/addRoles', role.addRoles)
router.post('/api/system/roleMenuTreeselect', role.roleMenuTreeselect)
router.post('/api/system/updateRole', role.updateRole)
router.post('/api/system/deleteRole', role.deleteRole)
router.post('/api/system/getRoleUser', role.getRoleUser)
router.post('/api/system/addRoleUser', role.addRoleUser)
router.post('/api/system/deleteRoleUser', role.deleteRoleUser)


router.post('/api/system/getPost', post.getPost)
router.post('/api/system/addPost', post.addPost)
router.post('/api/system/updatePost', post.updatePost)
router.post('/api/system/deletePost', post.deletePost)


router.post('/api/system/getDepartment', dept.getDepartment)
router.post('/api/system/addDept', dept.addDept)
router.post('/api/system/updateDept', dept.updateDept)
router.post('/api/system/deleteDept', dept.deleteDept)


// 字典
router.get('/api/getDicList', dict.getDicList);
router.post('/api/system/getDictTypeList', dict.getDictTypeList);
router.post('/api/system/getDictListByType', dict.getDictListByType);
router.post('/api/system/addDictType', dict.addDictType);
router.post('/api/system/deleteDictType', dict.deleteDictType);
router.post('/api/system/addDictData', dict.addDictData);
router.post('/api/system/deleteDictData', dict.deleteDictData);
router.post('/api/system/updateDictDataStatus', dict.updateDictDataStatus);


// 导出路由
module.exports = router;